import fs, {unlink} from "fs";

export default function (file: string[]) {
    if (file.length != 0) {

        for (let i = 0; i < file.length; i++) {
            console.log('判断文件是否存在')
             fs.exists('./src/attachments/' + file[i], (exists) => {
                if (exists){
                    unlink('./src/attachments/' + file[i], (err) => {
                        if (err) throw err;
                        console.log('successfully deleted ' + file);
                    })
                }else {
                    console.log('文件不存在')
                }
            })

        }
    }

}
